package com.slkj.shilixiaoyuanapp.entity;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.slkj.shilixiaoyuanapp.R;
import com.slkj.shilixiaoyuanapp.SlxyApplication;

import java.util.List;

/**
 * Created  on 2018-09-17
 *
 * @author 唐开阔
 * @describe
 */
public class StudentAttendanceEntity {

    /**
     * notLeave : [{"name":"刘钦澜","id":3,"type":1},{"name":"胡展睿","id":5,"type":1},{"name":"刘芷言","id":108,"type":1},{"name":"何欣奇","id":227,"type":1},{"name":"马梓轩","id":231,"type":1},{"name":"张家旭","id":232,"type":1},{"name":"康渊杰","id":233,"type":1},{"name":"冯灵芸","id":235,"type":1},{"name":"刘子腾","id":241,"type":1},{"name":"吴泽宇","id":242,"type":1},{"name":"丘宛星","id":243,"type":1},{"name":"吴思恒","id":356,"type":1},{"name":"何亦杨","id":454,"type":1},{"name":"黄思诚","id":455,"type":1},{"name":"郑孟骏","id":456,"type":1},{"name":"王羿涵","id":457,"type":1},{"name":"王梓博","id":463,"type":1},{"name":"黄颖洁","id":573,"type":1},{"name":"杨梓言","id":703,"type":1},{"name":"宋雨桐","id":704,"type":1},{"name":"肖然","id":705,"type":1},{"name":"陈浩髯","id":709,"type":1},{"name":"蒋丰与","id":711,"type":1},{"name":"周俊言","id":712,"type":1},{"name":"郭艺涵","id":713,"type":1},{"name":"李雅琪","id":897,"type":1},{"name":"蒋依芸","id":903,"type":1},{"name":"叶睿琪","id":904,"type":1},{"name":"刘悦彤","id":1013,"type":1},{"name":"刘沛凝","id":1016,"type":1},{"name":"何欣怡","id":1137,"type":1},{"name":"蒲艺文","id":1140,"type":1},{"name":"王文馨","id":1141,"type":1},{"name":"孙欣宇","id":1142,"type":1},{"name":"杨宸懿","id":1145,"type":1},{"name":"郭京昆","id":1146,"type":1},{"name":"陈峻浩","id":1148,"type":1},{"name":"陈涵予","id":1150,"type":1},{"name":"陈颜严","id":1152,"type":1},{"name":"郑诗怡","id":1190,"type":1},{"name":"苏畅","id":1234,"type":1},{"name":"陈语涵","id":1380,"type":1},{"name":"叶钰婷","id":1381,"type":1},{"name":"杨梓佚","id":1382,"type":1},{"name":"张帆","id":1383,"type":1},{"name":"赖雨桐","id":1388,"type":1},{"name":"李浩菱","id":1391,"type":1},{"name":"李皓月","id":1443,"type":1},{"name":"胡志豪","id":1598,"type":1},{"name":"刘杰涛","id":1604,"type":1},{"name":"曹婉莹","id":1605,"type":1},{"name":"叶子易","id":1606,"type":1},{"name":"赵源若","id":1609,"type":1},{"name":"谢成宇","id":1610,"type":1},{"name":"雷明明","id":1611,"type":1},{"name":"周小栩","id":1716,"type":1},{"name":"陈辰","id":1718,"type":1}]
     * classId : 2
     * leave : []
     */

    private int classId;
    private List<StudentEntity> notLeave;
    private List<StudentEntity> leave;

    public int getClassId() {
        return classId;
    }

    public void setClassId(int classId) {
        this.classId = classId;
    }

    public List<StudentEntity> getNotLeave() {
        return notLeave;
    }

    public void setNotLeave(List<StudentEntity> notLeave) {
        this.notLeave = notLeave;
    }

    public List<StudentEntity> getLeave() {
        return leave;
    }

    public void setLeave(List<StudentEntity> leave) {
        this.leave = leave;
    }

    public static class StudentEntity implements MultiItemEntity {
        /**
         * name : 刘钦澜
         * id : 3
         * type : 1
         */
        public static final int TYPE_LEAVE = 1;
        public static final int TYPE_KQ = 2;
        private String name;
        private int id;
        private int type;//0 请假 1 正常 2 迟到
        private boolean isLeave;//是否是请假
        private boolean isOpen = false;

        public boolean isLeave() {
            return isLeave;
        }

        public void setLeave(boolean leave) {
            isLeave = leave;
        }

        public boolean isOpen() {
            return isOpen;
        }

        public void setOpen(boolean open) {
            isOpen = open;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public int getType() {
            return type;
        }
        public String getTypeStr() {
            switch (type){
                case 0:
                    return "请假";
                case 1:
                    return "正常";

                case 2:
                    return "迟到";

            }
            return "";

        }
        public int getTypeColor() {
            switch (type){
                case 1:
                    return SlxyApplication.getContext().getResources().getColor(R.color.colorAccent) ;
                case 2:
                    return SlxyApplication.getContext().getResources().getColor(R.color.color_red) ;
            }
            return SlxyApplication.getContext().getResources().getColor(R.color.colorAccent) ;

        }
        public void setType(int type) {
            this.type = type;
        }

        @Override
        public int getItemType() {
            return type == 0?TYPE_LEAVE:TYPE_KQ;
        }
    }
}
